Add yarn.lock support (classic v1 and berry)#16
Merged
Conversation
|
Comprehensive yarn.lock parser added with extensive test coverage. 🎯 Quality: 86% Excellent · 📦 Size: Oversized — strongly consider breaking this down 📈 This month: Your 100th PR — above team average · Averaging Good |
Contributor
Author
|
/review |
d042e10 to
a74a6f1
Compare
Contributor
Author
|
/review |
mariojgt
approved these changes
May 21, 2026
Yarn is the last of the four major Node package managers we didn't yet read. This adds a zero-dep parser that handles both yarn classic (`version "x"`) and yarn berry (`version: x`, `__metadata` header, `npm:` descriptors) by walking the shared block structure and only branching on the value syntax. Yarn's lockfile, unlike pnpm v9's, doesn't record an importer manifest, so direct-vs-transitive marking is cross-referenced against the sibling `package.json`. Absent or unreadable package.json leaves all entries unmarked rather than failing the scan. Detection priority is npm > pnpm > yarn > bun, so a yarn migration in progress with multiple lockfiles still resolves deterministically and matches what the package manager itself would prefer. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
a74a6f1 to
be0c97e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
yarn.lockcovering both yarn classic (v1,version "x"field syntax) and yarn berry (v2+, YAML-styleversion: xwith__metadataheader andnpm:protocol descriptors)."axios@^1.6.0", "axios@~1.6.0":), quoted-comma edge cases, scoped names, and dedupes blocks that resolve to the samename@version.package.json(yarn's lockfile, unlike pnpm v9's, doesn't record an importer manifest). Missing or unreadable package.json leaves entries unmarked rather than failing the scan.Stacked on pnpm PR
Based on #15 so the diff here only shows yarn changes. GitHub will auto-retarget to
mainwhen #15 merges.Test plan
npm run typecheck— cleannpm test— 88/88 pass (21 new yarn tests; pnpm tests still green)npm run build— bundles updated dist/npx @patchstack/connect scan --dry-runagainst a real yarn classic project (e.g. a Next.js app generated withyarn create next-app)package.jsonare flagged🤖 Generated with Claude Code